package com.aigc.sclassroom.mapper;

import com.aigc.sclassroom.pojo.Class;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import java.util.List;


@Mapper
public interface ClassMapper {

    @Insert("insert into class(course_manage_id, create_time) values (#{courseManageId}, now())")
    @Options(useGeneratedKeys = true, keyProperty = "classId", keyColumn = "class_id")
    int add1(Class classObj);
    @Select("SELECT * FROM class WHERE class_id = #{classId}")
    Class getClassById(Long classId);

    @Insert("insert into class(course_manage_id,create_time)" +
            "values (#{courseManageId},now())")
    void add(Long courseManageId);

    @Select("select *\n" +
            "from class\n" +
            "where course_manage_id=#{courseManageId}")
    List<Class> selectAll(Long courseManageId);
}
